package com.shujia.wyh.day16;

/*
        替换功能
        public StringBuffer replace(int start,int end,String str)

 */
public class StringBufferDemo4 {
    public static void main(String[] args) {
        //创建一个StringBuffer对象
        StringBuffer sb = new StringBuffer("helloworldjavabigdata");
        System.out.println("sb:" + sb);
        System.out.println("实际存储字符的个数为："+sb.length());
        System.out.println("==============================================");
        //public StringBuffer replace(int start,int end,String str)
        //这里依旧是含头不含尾的[start,end)
        sb.replace(5,10,"hello");
        System.out.println("sb:" + sb);
        System.out.println("实际存储字符的个数为："+sb.length());
        System.out.println("==============================================");
        sb.replace(5,10,"好好学习天天向上");
        System.out.println("sb:" + sb);
        System.out.println("实际存储字符的个数为："+sb.length());
        System.out.println("==============================================");
        sb.replace(5,13,"yes");
        System.out.println("sb:" + sb);
        System.out.println("实际存储字符的个数为："+sb.length());



    }
}
